//
//  iComeApiManager.h
//  AFNetworking
//
//  Created by zhangrongwu on 2018/1/18.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "IMMessage.h"
#import "iComeSDKProtocol.h"

typedef enum {
    Server_RELEASE = 0,// 生产
    Server_PRE_RELEASE = 1,// 预生产
    Server_DEBUG = 2// 测试
}ServerType;

typedef void(^successCallBack)(id result);
typedef void(^failCallBack)(id result);
@interface iComeApiManager : NSObject
// https
@property (nonatomic, strong)NSString *url;
@property (nonatomic, strong)NSString *port;
// tcp
@property (nonatomic, strong)NSString *tcpUrl;
@property (nonatomic, assign)NSInteger tcprt;

@property (nonatomic, weak) id <iComeSDKProtocol>delegate;

+(instancetype)instance;

/**
 * @注册tcp
 * @eid
 * @用户密码
 * @server 0: 生产 1:预生产 2:测试
 * @回调处理 error data
 * @成功回调 用于极光推送的Alias唯一识别
 */

- (void)regiserApiUserName:(NSString *)userName passWord:(NSString *)passWord server:(ServerType)server :(successCallBack)success :(failCallBack)fail;
/**
 * @打开消息列表
 * @来源控制器页面 self
 * @打开成功失败 error : string
 */
- (void)openChatList:(UIViewController *)fromViewC :(successCallBack)success :(failCallBack)fail;
/**
 * @创建群组
 * @群组名称 @"测试群组名称" 默认使用时间戳
 * @用户列表 @[@"10045111", @"10045222", @"10045555"]
 * @来源控制器页面 self
 * @回调处理 gid : string,  error : string
 */
- (void)createGroupWithgName:(NSString *)gName eIds:(NSArray *)eIds fromViewC:(UIViewController *)fromViewC :(successCallBack)success :(failCallBack)fail;
/**
 * @打开双人会话
 * @对方的用户id
 * @来源控制器页面 self
 * @回调处理 成功失败
 */
- (void)openChatWith:(NSString *)eId fromViewC:(UIViewController *)fromViewC :(successCallBack)success :(failCallBack)fail;

/**
 * @打开某个会话窗口
 * @群组id
 * @需要发送的消息体
 * @来源控制器页面 self
 */
- (void)openChatWindowWithgId:(NSString *)gId message:(IMMessage *)message fromViewC:(UIViewController *)fromViewC :(successCallBack)success :(failCallBack)fail;
/**
 * @分享信息到iCome SDK
 * @需要发送的消息体 不需要填写to字段
 * @来源控制器页面 self
 * @分享回调逻辑
 */
- (void)shareToChatWithMessage:(IMMessage *)message fromViewC:(UIViewController *)fromViewC :(successCallBack)success :(failCallBack)fail;
/**
 * @群组添加人员
 * @群组gId
 * @eIds 人员列表
 */
- (void)appendUsers:(NSString *)gId eIds:(NSArray *)eIds :(successCallBack)success :(failCallBack)fail;

/**
 * @用户退出登录时调用
 * @外部退出登陆必须调用
 **/
- (void)destroy:(successCallBack)success :(failCallBack)fail;

/**
 * @打开通用的web
 */
- (void)pushWebViewControllerURL:(NSString *)URL
                       fromViewC:(UIViewController *)fromViewC
                        animated:(BOOL)animated;

/**
 * @获取最新的消息和未读数据
 * @msgGet
 */
- (void)msgGet:(successCallBack)success :(failCallBack)fail;

/**
 * @获取常用联系人
 * @@[@{@"eId":@"10045111",@"eName":@"张三"}]
 */
- (void)getRrecentPersion:(successCallBack)success :(failCallBack)fail;

/**
 * @获取所有的群组
 * @ 2 为多人组 1为双人组
 */
- (void)getGroupsWithgType:(NSInteger)type :(successCallBack)success :(failCallBack)fail;

/**
 * @获取某个群组所有人员
 * @gid群组id
 */
- (void)getUsersWithgId:(NSString *)gId :(successCallBack)success :(failCallBack)fail;

/**
 * @获取用户头像url
 * @员工id
 * @return url string
 */
- (NSString *)getEmpPhoto:(NSString *)eId;













// 该方法SDK外部无需调用
- (void)updateUnreadMsg;

@end




